Skip to content

Conversation

@trancexpress
Copy link
Contributor

This change adjusts JUnitLaunchConfigurationDelegate, to use bundle versions when adding required JUnit bundles.

E.g. when adding JUnit bundles for a JUnit 5 test, JUnit 5 versions are added.

This avoids conflicts when both JUnit 5 and JUnit 6 bundles are in the platform, since they share symbolic names.

Fixes: #2006

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Test Results

   771 files  ±0     771 suites  ±0   1h 11m 57s ⏱️ + 7m 2s
 3 609 tests ±0   3 556 ✅  - 1   52 💤 ±0  1 ❌ +1 
10 827 runs  ±0  10 669 ✅  - 1  157 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 2ca58a5. ± Comparison against base commit f588de6.

♻️ This comment has been updated with latest results.

@trancexpress
Copy link
Contributor Author

@HannesWell could you take a look here as well?

@HannesWell HannesWell self-requested a review October 10, 2025 16:10
@HannesWell
Copy link
Member

@HannesWell could you take a look here as well?

I'll have a look at it tomorrow. Thanks for working on this!

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this work.
I tried to answer at least some of your questions, but I think it needs a bit more general rework to handle versions properly.

Furthermore the class org.eclipse.pde.unittest.junit.launcher.JUnitPluginLaunchConfigurationDelegate, which is more or less a copy needs the similar adjustments too.

@trancexpress trancexpress force-pushed the gh2006 branch 2 times, most recently from f1b72a9 to 1515b1f Compare October 13, 2025 16:14
@eclipse-pde-bot
Copy link
Contributor

eclipse-pde-bot commented Oct 13, 2025

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

features/org.eclipse.pde.unittest.junit-feature/feature.xml
ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 301b68d6fea1d3027688831970460c0feee5914c Mon Sep 17 00:00:00 2001
From: Eclipse PDE Bot <[email protected]>
Date: Fri, 17 Oct 2025 21:06:02 +0000
Subject: [PATCH] Version bump(s) for 4.38 stream


diff --git a/features/org.eclipse.pde.unittest.junit-feature/feature.xml b/features/org.eclipse.pde.unittest.junit-feature/feature.xml
index 526088e3ee..175b86fb6b 100644
--- a/features/org.eclipse.pde.unittest.junit-feature/feature.xml
+++ b/features/org.eclipse.pde.unittest.junit-feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.pde.unittest.junit"
       label="%featureName"
-      version="1.0.1100.qualifier"
+      version="1.0.1200.qualifier"
       provider-name="%providerName"
       license-feature="org.eclipse.license"
       license-feature-version="0.0.0">
diff --git a/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF
index 149fe2a092..59f7d8b1d7 100644
--- a/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF
+++ b/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.pde.unittest.junit
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.pde.unittest.junit;singleton:=true
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.200.qualifier
 Bundle-Activator: org.eclipse.pde.unittest.junit.JUnitPluginTestPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
-- 
2.51.0

Further information are available in Common Build Issues - Missing version increments.

@trancexpress
Copy link
Contributor Author

Thanks for this work. I tried to answer at least some of your questions, but I think it needs a bit more general rework to handle versions properly.

Unfortunately I don't know enough about the code and available APIs to provide a rework.

Furthermore the class org.eclipse.pde.unittest.junit.launcher.JUnitPluginLaunchConfigurationDelegate, which is more or less a copy needs the similar adjustments too.

I've made change there too now.

@trancexpress
Copy link
Contributor Author

@HannesWell can you continue reviewing this? It would be nice to continue working on JUnit 6, which is blocked by the issue here.

@trancexpress
Copy link
Contributor Author

trancexpress commented Oct 15, 2025

One oddity with the current code is, I do need to specify junit-jupiter-api;bundle-version="[5,6)" for a JUnit plug-in test launch. If I don't specify the version constraints, even though we correctly detect and add JUnit 5 bundles in JUnitLaunchConfigurationDelegate.addRequiredJunitRuntimePlugins(ILaunchConfiguration), I still get this dialog:

junit_plugin_test_launch_errors

And so just launching a JUnit plug-in continues to not work when JUnit 5 and 6 are in the platform. The JUnit 5 plug-in test launch requires a MANIFEST.MF change. This is not the case for normal JUnit tests, where we run with JUnit 6 if we can (and in the case that the test must run on JUnit 5, the user has to change the MANIFEST.MF)...

@trancexpress trancexpress force-pushed the gh2006 branch 2 times, most recently from 315b26e to 8a1fa96 Compare October 15, 2025 11:52
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HannesWell can you continue reviewing this? It would be nice to continue working on JUnit 6, which is blocked by the issue here.

Yes, I'll continue tomorrow with an in-depth review. Sorry for the delay.
For now I just have a few style remarks.
Furthermore it looks like you added more changes to the version-bump commit pushed by the bot. I suggest you squash your changes into one commit and remove the version bump so that the bot can do it's thing again after you (force) pushed the update.

@trancexpress trancexpress force-pushed the gh2006 branch 2 times, most recently from b6c7fa7 to b1232ad Compare October 16, 2025 06:27
@trancexpress
Copy link
Contributor Author

Lets wait for test results, if everything is fine we should be able to merge.

HannesWell added a commit to HannesWell/eclipse.pde that referenced this pull request Oct 23, 2025
and define runtime requirements in the MANIFEST.MF with proper
version-ranges instead of in the pom.xml with unbound versions.

Required for
- eclipse-pde#2013
@HannesWell
Copy link
Member

We should split them into an own PR and merge them just right away to make this PR smaller, proof they work before and they do not relate directly to this PR.

Yes, lets extract that:

HannesWell added a commit to HannesWell/eclipse.pde that referenced this pull request Oct 23, 2025
HannesWell added a commit that referenced this pull request Oct 23, 2025
and define runtime requirements in the MANIFEST.MF with proper
version-ranges instead of in the pom.xml with unbound versions.

Required for
- #2013
HannesWell added a commit that referenced this pull request Oct 23, 2025
@trancexpress
Copy link
Contributor Author

trancexpress commented Oct 23, 2025

With the version bump commit gone, local build fails for me with:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23:15 min
[INFO] Finished at: 2025-10-23T13:58:45+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-plugin:5.0.0:p2-metadata-default (default-p2-metadata-default) on project org.eclipse.pde.doc.user: baseline and build artifacts have same version but different contents
[ERROR]    no-classifier: different
[ERROR]       reference/api/index-files/index-7.html: different
[ERROR]       reference/api/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.html: different
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-p2-plugin:5.0.0:p2-metadata-default (default-p2-metadata-default) on project org.eclipse.pde.doc.user: baseline and build artifacts have same version but different contents
   no-classifier: different
      reference/api/index-files/index-7.html: different
      reference/api/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.html: different

    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.MojoExecutionException: baseline and build artifacts have same version but different contents
   no-classifier: different
      reference/api/index-files/index-7.html: different
      reference/api/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.html: different

    at org.eclipse.tycho.plugins.p2.BaselineValidator.validateAndReplace (BaselineValidator.java:117)
    at org.eclipse.tycho.plugins.p2.P2MetadataMojo.attachP2Metadata (P2MetadataMojo.java:193)
    at org.eclipse.tycho.plugins.p2.P2MetadataMojo.execute (P2MetadataMojo.java:160)
    at org.eclipse.tycho.plugins.p2.P2MetadataDefaultMojo.execute (P2MetadataDefaultMojo.java:34)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :org.eclipse.pde.doc.user

I mean this commit:

diff --git a/org.eclipse.pde.doc.user/META-INF/MANIFEST.MF b/org.eclipse.pde.doc.user/META-INF/MANIFEST.MF
index 9acdc38884..02be78658a 100644
--- a/org.eclipse.pde.doc.user/META-INF/MANIFEST.MF
+++ b/org.eclipse.pde.doc.user/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.pde.doc.user; singleton:=true
-Bundle-Version: 3.17.300.qualifier
+Bundle-Version: 3.17.400.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.help;bundle-version="[3.2.0,4.0.0)"
diff --git a/org.eclipse.pde.doc.user/pom.xml b/org.eclipse.pde.doc.user/pom.xml
index e00c354770..6095472619 100644
--- a/org.eclipse.pde.doc.user/pom.xml
+++ b/org.eclipse.pde.doc.user/pom.xml
@@ -17,7 +17,7 @@
     <version>4.38.0-SNAPSHOT</version>
   </parent>
   <artifactId>org.eclipse.pde.doc.user</artifactId>
-  <version>3.17.300-SNAPSHOT</version>
+  <version>3.17.400-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
   
   <properties>

Other than this, there is no hang and the tests that were hanging pass:

Tests run: 32, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 32.98 s -- in JUnitRuntimeTests org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest

@laeubi
Copy link
Contributor

laeubi commented Oct 23, 2025

@trancexpress I'm currently prepare one more PR and then this error will be gone.

@laeubi
Copy link
Contributor

laeubi commented Oct 23, 2025

@trancexpress the pr (#2044) is merged now but GitHub is not smart enough to automatically rebase, can you do the rebase by:

  1. Fetch latest master
  2. Simply copy over your changes over mine in JUnitLaunchRequirements

That the hopefully should leave us with a PR that has a nice diff and mostly only JUnitLaunchRequirements changed

and remove unnecessary separate attempts to add junit-launcher and
jupiter.engine bundles to the runtime, intending to support
@RunWith(JUnitPlatform.class), because these bundles always are already
added to a runtime.

This change adjusts JUnitLaunchConfigurationDelegate,
to consider bundle versions when adding required JUnit bundles.
E.g. when adding JUnit bundles for a JUnit 5 test, JUnit 5 versions are
added.
This avoids conflicts when both JUnit 5 and JUnit 6 bundles are in the
platform, since they share symbolic names.

Furthermore handle multiple versions of a bundle when searching them in
the host.

Fixes: eclipse-pde#2006

Co-authored-by: Hannes Wellmann <[email protected]>
Co-authored-by: Ed Merks <[email protected]>
@trancexpress
Copy link
Contributor Author

trancexpress commented Oct 23, 2025

Great, many thanks @laeubi !

Lets see the test results, if all is well lets merge. I'll do checks with the aggregator repository in parallel, but any left-over we can continue in a separate PR. It will be way easier to test with this merged.

@trancexpress
Copy link
Contributor Author

trancexpress commented Oct 23, 2025

The fail on Windows is:

Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 11.00 s <<< FAILURE! -- in JUnitRuntimeTests org.eclipse.pde.junit.runtime.tests.JUnit5SuiteExecutionTest
org.eclipse.pde.junit.runtime.tests.JUnit5SuiteExecutionTest.executePackage -- Time elapsed: 3.181 s <<< FAILURE!
java.lang.AssertionError: test completed with Error
	at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.assertSuccessful(JUnitExecutionTest.java:141)
	at org.eclipse.pde.junit.runtime.tests.JUnit5SuiteExecutionTest.executePackage(JUnit5SuiteExecutionTest.java:68)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.pde.ui.tests.runtime.TestUtils$1.evaluate(TestUtils.java:267)
	Suppressed: java.lang.AssertionError: FailureTrace of TestSuite: verification.tests.junit5.suite.TestSuite : Completed - Error (0):

org.junit.platform.suite.engine.NoTestsDiscoveredException: Suite [verification.tests.junit5.suite.TestSuite] did not discover any tests
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)


		at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.addFailureTraces(JUnitExecutionTest.java:151)
		at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.addFailureTraces(JUnitExecutionTest.java:156)
		at org.eclipse.pde.junit.runtime.tests.JUnitExecutionTest.assertSuccessful(JUnitExecutionTest.java:142)
		... 3 more

org.eclipse.pde.junit.runtime.tests.JUnit5SuiteExecutionTest.executeProject -- Time elapsed: 3.926 s
org.eclipse.pde.junit.runtime.tests.JUnit5SuiteExecutionTest.executeSuite -- Time elapsed: 2.318 s
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 71.03 s -- in org.eclipse.pde.junit.runtime.tests.JUnitRuntimeTests

Results:

Failures: 
  JUnit5SuiteExecutionTest.executePackage:68 test completed with Error

That does look related, though why only on Windows I have no idea. Also I have no Windows machine so I can't check the fail.

@merks
Copy link
Contributor

merks commented Oct 23, 2025

I'm rerunning the Windows job. Probably just a glitch. Goodness knows we have plenty of those.

@merks
Copy link
Contributor

merks commented Oct 23, 2025

FYI, I do have a Windows machine so I will rerun the local Tycho build with this PR to test it.

@merks
Copy link
Contributor

merks commented Oct 23, 2025

It works for me locally:

[INFO] org.eclipse.pde.junit.runtime.tests 3.8.200-SNAPSHOT SUCCESS [ 56.449 s]

@merks
Copy link
Contributor

merks commented Oct 23, 2025

The test did pass but I think the "collector" didn't update the results properly:

image

@merks merks merged commit b66c8ab into eclipse-pde:master Oct 23, 2025
22 of 24 checks passed
@trancexpress
Copy link
Contributor Author

Great, thank you as well @merks , @HannesWell !

@HannesWell
Copy link
Member

It's great that this has finally landed.
I think overall this was great teamwork and special thanks to you @trancexpress for driving this. This PR revealed multiple hard flaws in PDE and lead to them being fixed.

With the version bump commit gone, local build fails for me with:

Just for you infromation, in case you encounter this again. The error says that the content of the project org.eclipse.pde.doc.user changed while it has the same qualifier. In this case that's because that doc-bundle pulls in the java-doc generated for other projects. And as this used to change an API class (even though the removed method was marked as no-reference) this was the result. Changing any file in the project changes the qualifier too.
Therefore, In such case we usually just change the forceQualifierUpdate.txt file as Christoph did in:

@HannesWell HannesWell mentioned this pull request Oct 23, 2025
@trancexpress
Copy link
Contributor Author

Therefore, In such case we usually just change the forceQualifierUpdate.txt file as Christoph did in:

* [Centralize code used in two places to compute JUnit requirements #2044](https://github.com/eclipse-pde/eclipse.pde/pull/2044)

I see, thank you for letting me know!

trancexpress pushed a commit to trancexpress/eclipse.pde that referenced this pull request Nov 10, 2025
and define runtime requirements in the MANIFEST.MF with proper
version-ranges instead of in the pom.xml with unbound versions.

Required for
- eclipse-pde#2013
trancexpress pushed a commit to trancexpress/eclipse.pde that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use version constraints from org.junit.jupiter.api when automatically adding JUnit 5 bundles to test launch

7 participants